package com.dody.agile.payment.transaction;

import com.dody.agile.payment.affilication.Affiliation;
import com.dody.agile.payment.affilication.UnionAffiliation;
import com.dody.agile.payment.employee.Employee;

/**
 * @author ShiXin
 * @date 2019/4/13 20:41
 * @description agile
 */
public class ServiceChargeTransaction extends PayrollTransaction {

    private Integer memberId;
    private Long date;
    private Double charge;

    public ServiceChargeTransaction(Integer memberId, Long date, Double charge) {
        this.memberId = memberId;
        this.date = date;
        this.charge = charge;
    }

    @Override
    public void execute() {
        Employee e = payrollDatabase.getUnionMember(memberId);
        Affiliation af = e.getAffiliation();
        UnionAffiliation uaf = (UnionAffiliation)af;
        uaf.addServiceCharge(date, charge);
    }
}
